﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Role_Power_delete : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int id = int.Parse(Request["id"]);
            CMSModel.CMSEntities dal = DAL.DBManager.GetCmsEmtity();
            CMSModel.Role_Power role_power = dal.Role_Power.First(x=>x.id==id);
            try
            {
                dal.DeleteObject(role_power);
                dal.SaveChanges();
                ClientScript.RegisterStartupScript(GetType(), "delete", "alert('删除成功'),document.location='Default.aspx'", true);
            }
            catch (Exception ex)
            {
                LogYuMin.LogWriter.GetWriter(LogYuMin.LogFile.error).Write(GetType(), "deleteRole_Power", LogYuMin.LogStates.ERROR, ex);
                ClientScript.RegisterStartupScript(GetType(), "delete", "alert('删除失败')", true);
            }
        }
    }
}